#!/bin/sh

# scp.sh machine_index file1 file2 ....

if [ $# -lt 2 ]; then
	echo "usage: scp.sh machine_index file1 [file2] [...]";
	echo "machines_index=1: 172.16.196.91";
	echo "machines_index=2: 172.23.24.25";
	exit 1;
fi

INDEX=$1;shift;
if [ ${INDEX} -eq im_ctrl ]; then
	IP=172.16.83.65
	USER=yangxin
	PASSWD=yangxin@zhishi
	DEST=/home/yangxin/bin/
	PORT=22
fi
BIN_DIR=`pwd`/`dirname $0`
BIN_NAME=`basename $0 | sed -n -e 's/\.sh$/\.exp/ p'`;
#echo "${BIN_DIR} + ${BIN_NAME}";
#exit 0;
for FILE in $*; do
#	echo "file:${FILE}";
	${BIN_DIR}/${BIN_NAME} ${FILE} ${USER} ${IP} ${DEST} ${PASSWD}  ${PORT}
done
